<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->increments('id');
            $table->string('commentable_type')->default('')->comment('评论类型');
            $table->unsignedInteger('commentable_id')->default(0)->comment('所属id');
            $table->string('name')->default('')->comment('留言作者');
            $table->string('email')->default('')->comment('email地址');
            $table->string('phone')->default('')->comment('留言作者手机号');
            $table->text('content')->nullable()->comment('评论内容');
            $table->boolean('review')->default(false)->comment('是否已审核,默认不通过');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('comments');
    }
}
